package com.lanp.gencode;

import cn.hutool.core.util.StrUtil;
import com.lanp.gencode.utils.DocUtil;

import java.util.ArrayList;
import java.util.List;

public class RunDocApi {
    static String prefix = "";
    static String prefix_name = "";
    static boolean isrequire = false;
    static List<String> list = new ArrayList<String>() {{
        add("versionNumber");
        add("serialVersionUID");
        add("available");
        add("updateTime");
        add("updateNickname");
        add("delTime");
        add("delNickname");
    }};

    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();

        List<DocUtil.VoDoc> voDocs = DocUtil.JavaToDoc(
                "E:\\code\\sigo_code\\dr\\dr-mbg\\src\\main\\java\\com\\wyshown\\dr\\mbg\\a.java");

        for (DocUtil.VoDoc voDoc : voDocs) {
            if (list.contains(voDoc.getFieldName())) {
                continue;
            }
            sb.setLength(0);
            /* -------------------------- 1 ------------------------- */
            sb.append("<tr role=\"row\">\n" +
                    "<td colspan=\"1\" class=\"confluenceTd\">\n" +
                    "<pre><span style=\"color: rgb(0,0,0);\">");

            sb.append(prefix + (StrUtil.toUnderlineCase(voDoc.getFieldName())));

            sb.append("</span></pre>\n" +
                    "</td>\n" +
                    "<td colspan=\"1\" class=\"confluenceTd\">");
            sb.append(voDoc.getFieldType());
            sb.append("</td>\n");
            if (isrequire) {
                sb.append("<td colspan=\"1\" class=\"confluenceTd\"></td>");
            }
            sb.append("<td colspan=\"1\" class=\"confluenceTd\">");
            sb.append(prefix_name + voDoc.getCommentText());
            sb.append("</td>\n" +
                    "<td colspan=\"1\" class=\"confluenceTd\"></td>\n" +
                    "</tr>");


            /* -------------------------- 2 ------------------------- */
            //sb.append(String.format("|%s |否  |%s |%s |"
            //        , prefix + (StrUtil.toUnderlineCase(voDoc.getFieldName()))
            //        , voDoc.getFieldType()
            //        , prefix_name + voDoc.getCommentText()));

            System.out.println(sb);
        }
    }
}

/*

<tr role="row">
<td colspan="1" class="confluenceTd">
<pre><span style="color: rgb(102,14,122);">add_film_color</span></pre>
</td>
<td colspan="1" class="confluenceTd">String</td>
<td colspan="1" class="confluenceTd">是否必填</td>
<td colspan="1" class="confluenceTd">123</td>
<td colspan="1" class="confluenceTd">123</td>
</tr>

 */
